<%-- 
    Document   : bukuAdd
    Created on : Feb 22, 2015, 3:16:25 PM
    Author     : Kim
--%>

<%@ include file="/common/header.jsp"%>

<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">Master Buku</h1>
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    Form Buku
                </div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-12">
                            <form:form id="saveForm" name="saveForm" method="post" modelAttribute="buku" enctype="multipart/form-data">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">Kode Buku</label>
                                    <input class="form-horizontal" type="text" id="kodeBuku" name="kodeBuku"
                                           <c:if test="${not empty buku}">value="<c:out value='${buku.kodeBuku}' />" readonly="true"</c:if> />
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">Nama Buku</label>
                                        <input class="form-horizontal" type="text" id="namaBuku" name="namaBuku"
                                        <c:if test="${not empty buku}">value="<c:out value='${buku.namaBuku}' />"</c:if> />
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">Gambar Cover</label>
                                        <input class="form-horizontal" type="file" id="fileGambar" name="fileGambar" />
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">Pengarang</label>
                                        <select class="form-horizontal" name="kodePengarang">
                                            <option value="0"> Pilih Salah Satu </option>
                                        <c:forEach items="${pengarangList}" var="list">
                                            <option value="<c:out value="${list.kodePengarang}" />"
                                                    <c:if test="${not empty buku}" >
                                                        <c:if test="${buku.pengarang.kodePengarang == list.kodePengarang}">selected="yes"</c:if>
                                                    </c:if>
                                                    >
                                                <c:out value="${list.namaPengarang}" />
                                            </option>
                                        </c:forEach>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">Genre</label>
                                    <table>
                                        <tr>
                                            <td>
                                                <div class="checkbox">
                                                    <label>
                                                        <input type="checkbox" value="Horor" name="kodeGenre" <c:if test="${not empty Horor}">checked="true"</c:if>/> Horor 
                                                    </label>
                                                </div> 
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <div class="checkbox">
                                                    <label>
                                                        <input type="checkbox" value="Fantasy" name="kodeGenre" <c:if test="${not empty Fantasy}">checked="true"</c:if>/> Fantasy 
                                                    </label>
                                                </div> 
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <div class="checkbox">
                                                    <label>
                                                        <input type="checkbox" value="Sport" name="kodeGenre" <c:if test="${not empty Sport}">checked="true"</c:if>/> Sport 
                                                    </label>
                                                </div> 
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">Descripsi</label>
                                    <textarea class="form-horizontal col-sm-5" type="text" id="descBuku" name="descBuku" rows="3"><c:if test="${not empty buku}"><c:out value='${buku.descBuku}' /></c:if></textarea>
                                    </div>
                                    <div class="form-group" >
                                        <div class="col-sm-offset-2 col-sm-6" style="padding-top: 10px">
                                        <c:if test="${empty buku}">
                                            <input type="button" value=" Simpan " class="btn btn-primary" onclick="functionSave('<c:url value="/page/bukuAdd.html" />');" />
                                        </c:if>
                                        <c:if test="${not empty buku}">
                                            <input type="button" value=" Simpan " class="btn btn-primary" onclick="functionSave('<c:url value="/page/bukuUpdate.html" />');" />
                                        </c:if>
                                        <input type="button" value=" Batal " class="btn btn-default" onclick="backList('<c:url value="/page/bukuView.html" />');" /> 
                                    </div>
                                </div>
                            </form:form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<%@ include file="/common/footer.jsp"%>